<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			body {
				font-family: cursive;
			}
		</style>
	</head>
	<body>




		<script>
			var num = prompt('请输入金字塔层数');
			for (var i = 0; i < num; i++) {

				for (var j = 0; j < num - i - 1; j++) {
					document.write("&nbsp;")
				}
				for (var k = 0; k < (i + 1) * 2 - 1; k++) {
					document.write("*")
				}
				document.write("<br>")
			}
		</script>
	</body>
</html>
